package work;

/**
 * @TODO
 * @Author xu
 * 2025/2/24
 */
import java.util.Random;
import java.util.Scanner;
public class Day4_8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入班级人数: ");
        int classSize = scanner.nextInt();
        int[] grades = new int[classSize];
        Random random = new Random();
        int failCount = 0;
        int totalScore = 0;

        for (int i = 0; i < classSize; i++) {
            grades[i] = random.nextInt(101);
            totalScore += grades[i];
            if (grades[i] < 60) {
                failCount++;
            }
        }
        double averageScore = (double) totalScore / classSize;

        System.out.println("不及格人数: " + failCount);
        System.out.printf("班级平均分: %.2f%n", averageScore);
    }

}
